#12 open

Cannot seem to change password length validations

Reported by sermoa | August 26th, 2008 @ 03:33 PM

The code is found in lib/authentication/by_password.rb - it says 6..40

I need it to be 8..40. Obviously i could just change it there, but i don't really want to do that, since we like to use submodules and everyone would need to make the change.

Ideally i'd like it to be set in the model. I tried just entering it there, but Rails seems to run both validations rather than overriding the by_password.rb one.

I have a solution which 'works' but doesn't feel very nice. You can see it at http://github.com/sermoa/restful...

Thanks for your help! Aimee.

Comments and changes to this ticket

  • mrflip

    mrflip August 26th, 2008 @ 04:07 PM

    • State changed from “new” to “open”

    Would you consider changing it to use mattr_accessor -- see lib/authentication.rb for example usage? I think that's the rails-ier way you want. The only changes at the plugin level would be in lib/authentication/by_password.rb and you could ditch the methods.

    Figuring out the scope might make it complicated, and I can make the change if it gives you trouble.

    (more on mattr_accessor: http://toolmantim.com/article/20...

    Thanks for the patch!

  • sermoa

    sermoa August 26th, 2008 @ 04:36 PM

    Hmm, i am trying to change it to mattr_accessor like you suggest ...

    It does not seem to work because you need to load the module before you can set the value, but in loading the module you also end up setting up the validation, before getting a chance to override it.

    It is a catch-22, is it not?

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Restful Authentication Generator

This widely-used plugin provides a foundation for securely managing user
* Login / logout
* Secure password handling
* Account activation by validating email
* Account approval / disabling by admin
* Rudimentary hooks for authorization and access control.


People watching this ticket